from selenium import webdriver
from time import sleep
from selenium.webdriver.common.action_chains import ActionChains

try:
    driver = webdriver.Chrome()
    driver.get('https://www.baidu.com')

    driver.find_element_by_id('kw').send_keys('天和核心仓')
    driver.find_element_by_id('su').click()
    sleep(2)

    # 运行js代码
    # driver.execute_script('alert("你好！")')
    # 滚动页面
    driver.execute_script('arguments[0].scrollIntoView();',driver.find_element_by_xpath('//*[@id="rs"]/div/div'))





except Exception as e:
    print(e)
finally:
    sleep(2)
    driver.quit()